package com.hkbigdata.userprofile.common.dao

import com.hkbigdata.userprofile.common.bean.TagInfo
import com.hkbigdata.userprofile.common.util.MySqlUtil

/**
 * @author liuanbo
 * @creat 2024-04-12-15:12
 * @see 2194550857@qq.com
 *
 */
object TagInfoDAO {
  def TagInfoDaoBytaskid(taskid: String): TagInfo = {
    val maybeInfo = MySqlUtil.queryOne(s"select * from tag_info where tag_task_id='$taskid'", classOf[TagInfo], true)
    if (maybeInfo == None) {
      throw new RuntimeException("task id not found")
    }
    maybeInfo.get

  }

  def getTaskTagMergeOntask(): List[TagInfo] = {
    val infoes = MySqlUtil.queryList(s"select tag.* from " +
      s"tag_info tag join task_info task on tag.tag_task_id=task.id " +
      s"where task.task_status='1'", classOf[TagInfo], true)
    if (infoes == None) {
      throw new RuntimeException("task id not found")
    }
    infoes
  }
}
